home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / freeWAIS-sf-1.1 / ir / cdialect.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-13  |  4.1 KB  |  173 lines

  1. /* WIDE AREA INFORMATION SERVER SOFTWARE:
  2.    No guarentees or restrictions.  See the readme file for the full standard
  3.    disclaimer.
  4.  
  5.    5.29.90    Harry Morris, morris@think.com
  6. */
  7.  
  8. /* Copyright (c) CNIDR (see ../COPYRIGHT) */
  9.  
  10.  
  11. /* there are three kinds of C that we have encountered so far:
  12.  
  13.          1. ANSI_LIKE     - full prototypes and stdargs and ansi includes
  14.          2. PROTO_ANSI     - full prototypes, varargs and misc includes
  15.          3. K_AND_R    - k&r prototypes, varargs and misc includes
  16.          
  17.   This file is a mess because some compilers do not handle elif.  sorry.
  18.  
  19.   defined symbols for other machines:
  20.     hp:         hpux
  21.     Next:       NeXT 
  22. */
  23.  
  24. #ifndef C_DIALECT
  25. #define C_DIALECT
  26.  
  27. /*----------------------------------------------------------------------*/
  28.  
  29. #include "../config.h"
  30. #ifndef USTUBS_H
  31. #include <stdlib.h>
  32. #endif /* USTUBS_H */
  33. /* AIX requires this to be the first thing in the file.  */
  34. #ifdef __GNUC__
  35. #define alloca __builtin_alloca
  36. #else /* not __GNUC__ */
  37. #if HAVE_ALLOCA_H
  38. #include <alloca.h>
  39. #else /* not HAVE_ALLOCA_H */
  40. #ifdef _AIX
  41.  #pragma alloca
  42. #else /* not _AIX */
  43. char *alloca ();
  44. #endif /* not _AIX */
  45. #endif /* not HAVE_ALLOCA_H */
  46. #endif /* not __GNUC__ */
  47.  
  48. #ifdef TIME_WITH_SYS_TIME 
  49. /* #ifdef TM_IN_SYS_TIME */
  50. #include <sys/time.h>
  51. #include <time.h>
  52. #else
  53. #ifdef HAVE_SYS_TIME_H
  54. #include <sys/time.h>
  55. #else
  56. #include <time.h>
  57. #endif
  58. #endif
  59.  
  60. #include <sys/types.h>          /* does this line any harm? (up) */
  61.  
  62. #ifdef HAVE_UNISTD_H
  63. #include <unistd.h>
  64. #endif
  65.  
  66.  
  67. /* unistd.h defines _POSIX_VERSION on POSIX.1 systems.  */
  68. #if defined(DIRENT) || defined(_POSIX_VERSION)
  69. #include <dirent.h>
  70. #define NLENGTH(dirent) (strlen((dirent)->d_name))
  71. #else /* not (DIRENT or _POSIX_VERSION) */
  72. #define dirent direct
  73. #define NLENGTH(dirent) ((dirent)->d_namlen)
  74. #ifdef SYSNDIR
  75. #include <sys/ndir.h>
  76. #endif /* SYSNDIR */
  77. #ifdef SYSDIR
  78. #include <sys/dir.h>
  79. #endif /* SYSDIR */
  80. #ifdef NDIR
  81. #include <ndir.h>
  82. #endif /* NDIR */
  83. #endif /* not (DIRENT or _POSIX_VERSION) */
  84.  
  85.  
  86. #if STDC_HEADERS || HAVE_STRING_H
  87. #include <string.h>
  88. /* An ANSI string.h and pre-ANSI memory.h might conflict.  */
  89. #if !STDC_HEADERS && HAVE_MEMORY_H
  90. #include <memory.h>
  91. #endif /* not STDC_HEADERS and HAVE_MEMORY_H */
  92. #ifdef index
  93. #undef index
  94. #endif
  95. #define index strchr
  96. #ifdef rindex
  97. #undef rindex
  98. #endif
  99. #define rindex strrchr
  100. /* #define bcopy(s, d, n) memcpy ((d), (s), (n)) */
  101. #define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))
  102. #define bzero(s, n) memset ((s), 0, (n)) 
  103. #else /* not STDC_HEADERS and not HAVE_STRING_H */
  104. #include <strings.h>
  105. /* memory.h and strings.h conflict on some systems.  */
  106. #endif /* not STDC_HEADERS and not HAVE_STRING_H */
  107.  
  108. #include <ctype.h>              /* local version redefines string functions */
  109.  
  110. /*
  111.  * How about the memory copy routines ?
  112.  */
  113. #if HAVE_BCOPY && BCOPY_OVERLAP
  114. /* ok: have bcopy() and it does overlapping copies */
  115. #else  /* HAVE_BCOPY && BCOPY_OVERLAP */
  116. #if HAVE_MEMCPY && MEMCOPY_OVERLAP
  117. /* ok: have memcpy() and it does overlapping copies */
  118. #define bcopy(s, d, n) memcpy ((d), (s), (n))
  119. #else /* HAVE_MEMCPY && MEMCPY_OVERLAP */
  120.  
  121. /* Neither bcopy() nor memcopy() do overlapping copies */
  122. #define bcopy(d, s, n) mybcopy ((d), (s), (n))
  123. #define NEED_MYBCOPY
  124. #endif /* HAVE_MEMCPY && MEMCPY_OVERLAP */
  125. #endif /* HAVEHAVE_BCOPY && BCOPY_OVERLAP */
  126.  
  127. #ifdef undef
  128. extern double    atof(/* const char *nptr */);
  129. extern int    atoi(/* const char *nptr */);
  130. extern long int    atol(/* const char *nptr */);
  131. #endif
  132. #ifdef AC_STDC_HEADERS
  133. #define ANSI_LIKE
  134. #else
  135. #define K_AND_R
  136. #endif
  137.  
  138. /* set up the function prototyping convention */
  139.  
  140. #ifdef ANSI_LIKE
  141. #define _AP(args) args
  142. #elif defined (PROTO_ANSI)
  143. #define _AP(args) args
  144. #elif defined(K_AND_R)
  145. #define _AP(args) ()
  146. #endif /* def ANSI_LIKE */
  147.  
  148. /* if you are not k_and_r, then load in ustubs always */
  149. #ifdef K_AND_R
  150. #include "ustubs.h"
  151. #endif /* def K_AND_R */
  152.  
  153. /* Comment this back in to figure out what the compiler thinks we are */
  154. /*
  155. #ifdef ANSI_LIKE
  156. WeareAnsiLike
  157. #endif
  158. #ifdef PROTO_ANSI
  159. WeareProtoAnsi
  160. #endif
  161. #ifdef K_AND_R
  162. WeareKandR
  163. #endif
  164. Crash-and-Burn
  165. */
  166. /* End of chunk to comment back in */
  167.  
  168. #endif /* ndef C_DIALECT */
  169.  
  170. /*----------------------------------------------------------------------*/
  171.  
  172.  
  173.